Skip to content

feat(webhook/sink): implement http request for reset action#920

Open
paulobressan wants to merge 2 commits intomainfrom
919-handling-rollbacks-with-the-webhook-sink-oura-v2
Open

feat(webhook/sink): implement http request for reset action#920
paulobressan wants to merge 2 commits intomainfrom
919-handling-rollbacks-with-the-webhook-sink-oura-v2

Conversation

@paulobressan
Copy link
Copy Markdown
Member

@paulobressan paulobressan commented Mar 9, 2026

Close #919

Summary by CodeRabbit

  • Bug Fixes
    • Webhook handling now correctly supports apply, undo, and reset events.
    • Request payloads are built per event type, avoiding invalid or missing bodies.
    • Removed unsafe assumptions about record availability and improved error handling for webhook processing.

@paulobressan paulobressan requested a review from scarmuega as a code owner March 9, 2026 15:44
@paulobressan paulobressan linked an issue Mar 9, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 948a611d-3927-4038-ad03-2554f0b34b42

📥 Commits

Reviewing files that changed from the base of the PR and between 1422e3b and cc7e57a.

📒 Files selected for processing (1)
  • src/sinks/webhook.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/sinks/webhook.rs

📝 Walkthrough

Walkthrough

The webhook sink's execute now pattern-matches ChainEvent variants. Apply and Undo build requests with action "apply"/"undo" and a body from the record; Reset builds a "reset" request with a constructed body reflecting the reset and current point. Early-return on missing record was removed.

Changes

Cohort / File(s) Summary
Webhook Event Handling
src/sinks/webhook.rs
Refactored execute to match ChainEvent variants. Compute request action and body per variant: Apply/Undo use record-derived bodies, Reset uses a constructed reset body. Removed prior early-return on absent record and consolidated request construction after the match.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code with twitchy whisker gleam,
Apply and Undo now dance in the stream.
Reset stands ready, tidy and neat,
No more lost rollbacks — the flows all meet. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references the reset action HTTP request implementation, matching the primary code change that adds reset event handling to the webhook sink.
Linked Issues check ✅ Passed The PR implements HTTP request handling for reset events in the WebHook sink, directly addressing issue #919's requirement to surface rollback/reset events.
Out of Scope Changes check ✅ Passed All changes in webhook.rs are focused on implementing reset action handling and supporting Apply/Undo events, staying within the scope of issue #919.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 919-handling-rollbacks-with-the-webhook-sink-oura-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/sinks/webhook.rs`:
- Around line 68-72: ChainEvent::Reset currently sends a bodyless POST (in the
ChainEvent::Reset arm where self.client.post(&stage.config.url) is called), so
include a JSON body that serializes the reset point to match the existing reset
shape defined in framework (use the same struct/fields from the reset shape in
src/framework/mod.rs), set the appropriate Content-Type header, and send that
JSON as the request body along with the existing headers (use the same point
value as point_header in the body). Locate the ChainEvent::Reset match arm and
replace the bodyless request with one that serializes the reset payload (the
same type/field names used in the framework reset shape) and calls .json(...) or
equivalent before sending.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a645d900-ff41-4748-93dd-256eb9a99431

📥 Commits

Reviewing files that changed from the base of the PR and between d5c6d6a and 1422e3b.

📒 Files selected for processing (1)
  • src/sinks/webhook.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handling rollbacks with the WebHook sink (Oura v2)

1 participant